//============================================================================
// Name        : Buffalo_New_Structure.cpp
// Author      : zwx
// Version     :
// Copyright   : copyright zwx
// Description : Hello World in C++, Ansi-style
//============================================================================


#include "Include/includes.h"
#include "Processor/Crawler.h"
#include "Entity/Collection.h"
#include "Processor/PosInvIndexer.h"
#include "Processor/AutCatInvIndexer.h"
using namespace std;

int main(int argc, char** argv) {
	double run_time;
	clock_t start, finish;
	if ( argc < 3 ) {	//source data location and dictionary location
		cout << "need more arguments" << endl;
		return 0;
	}

	start = clock();
	string src = argv[1];		//original files' location
	string dest = argv[2];		//location of directory
	Crawler crawler;
	crawler.initialize(dest);
	crawler.crawl(src, dest);
	crawler.finale(dest, run_time);
	PosInvIndexer pii;
	AutCatInvIndexer acii;
	pii.makeIndex(dest);
	acii.makeAutInvIndex(dest);
	acii.makeCatInvIndex(dest);
	finish = clock();
	run_time = (double)(finish - start)/CLOCKS_PER_SEC;
	cout<<"APPLICATION EXITS. TOTAL RUN TIME: "<<run_time<<" SECONDS"<<endl;
	return 0;
}

